package com.cq.hd.member.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cq.hd.member.po.TbAutoWithdrawalRecordPo;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 自动提现记录 mapper
 */
public interface TbAutoWithdrawalRecordMapper extends BaseMapper<TbAutoWithdrawalRecordPo> {

    List<TbAutoWithdrawalRecordPo> selectWaitWithdrawalRecords();

    /**
     * 更新自动提现记录为已发起提现申请
     * @param id 自动提现记录id
     * @return 影响条数
     */
    int updateToAlready(@Param("id")Long id, @Param("withdrawalId")Long withdrawalId);

    TbAutoWithdrawalRecordPo selectByWithdrawalId(Long withdrawalId);

    BigDecimal sumWithdrawalAmount(@Param("merchantId") Long merchantId, @Param("state") Integer state);

}
